<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>一朵 -- 订单详情</title>
    <!-- swiper-2.7css -->
    <link rel="stylesheet" href="__STATIC__/index//js/swiper/idangerous.swiper.css">
    <!-- swiper-2.7js -->
    <script src="__STATIC__/index//js/swiper/idangerous.swiper.min.js"></script>
    <!-- jquery-3.2.1引用 -->
    <script src="__STATIC__/index//js/global/jquery-3.2.1.min.js"></script>
    <!-- 阿里巴巴矢量图库 -->
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_561814_z72ky81kih08uxr.css">
    <!-- 公共头部 脚部 -->
    <link rel="stylesheet" href="__STATIC__/index//css/global/global.css">
    <!-- 超过1200屏幕 -->
    <link rel="stylesheet" media="screen and (min-width: 1200px)" href="__STATIC__/index//css/order_content/order_content1200.css"
    />
    <!-- 1080-1200 -->
    <link rel="stylesheet" media="screen  and (min-width: 1080px) and (max-width: 1199px) " href="__STATIC__/index//css/order_content/order_content1080.css"
    />
    <!-- 960-1080 -->
    <link rel="stylesheet" media="screen  and (min-width: 960px) and (max-width: 1079px) " href="__STATIC__/index//css/order_content/order_content960.css"
    />
    <!-- 768-959 -->
    <link rel="stylesheet" media="screen  and (min-width: 768px) and (max-width: 959px) " href="__STATIC__/index//css/order_content/order_content768.css"
    />
    <!-- 568-767 -->
    <link rel="stylesheet" media="screen  and (min-width: 568px) and (max-width: 767px) " href="__STATIC__/index//css/order_content/order_content568.css"
    />
    <!-- 375-567 -->
    <link rel="stylesheet" media="screen  and (min-width: 375px) and (max-width: 567px) " href="__STATIC__/index//css/order_content/order_content375.css"
    />
    <!-- 小于375-->
    <link rel="stylesheet" media="screen  and (max-width: 374px) " href="__STATIC__/index//css/order_content/order_content320.css"
    />
    <!--一引入layer-->
    <script src="__STATIC__/layer/layer.js"></script>
</head>

<body>

    <div class="M">
        <div class="m-header">
            <div>
                <span onclick="go_back();">
                    <span class="iconfont icon-xiangzuo"></span>
                    返回
                </span>
                <span>订单详情</span>
                <span>
                    {if condition="!empty($realname)"}
                    <a href="{:url('User/index')}" class="my">
                        {$realname}
                    </a>
                    {else /}
                    <a href="{:url('Login/loginin')}">登录</a>
                    <a href="{:url('Login/register')}">注册</a>
                    {/if}
                    <a href="{:url('MyCart/my_cart')}" class="car">
                        <span class="iconfont icon-gouwuche"></span>
                        <span>{$cart_num}</span>
                    </a>

                </span>
            </div>
        </div>
        {if condition="$order.order_status eq 8"}
        <div class="m-status-close">
            <p>交易关闭</p>
            <p>欢迎重新下单购买</p>
        </div>
        {/if} {if condition="$order.order_status eq 4"}
        <div class="m-status-complete">
            <p>交易完成</p>
            <p>欢迎下次光临</p>
        </div>
        {/if} {if condition="$order.order_status eq 0"}
        <div class="m-status-pay">
            <p>等待买家付款</p>
            <p>请立即付款</p>
        </div>
        {/if} {if condition="($order.order_status gt 0) AND ($order.order_status lt 4)"}
        <div class="m-status-pay">
            {if condition="$order.is_ziqu eq 0"}
            <p>商品配送中</p>
            <p>商品正在配送中</p>
            {else /}
            <p>商品准备中</p>
            <p>商品等待取货</p>
            {/if}
        </div>
        {/if}
        <!-- 地址选择 -->
        <div class="m-address">
            <div>
                {if condition="$order.is_ziqu eq 0"}
                <p class="m-name">{$order.address}
                </p>
                <p class="m-phone">
                    <span>{$order.consignee}</span>
                    <span>{$order.mobile}</span>
                </p>
                {else /}
                <p class="m-ziqu-headline">
                    <i class="iconfont icon-dizhi"></i>
                    <span>自取地址</span>
                </p>
                <p class="m-name1">
                    {$store_info.address}
                </p>
                <p class="m-phone1">
                    <span>联系电话：</span>
                    <span>
                        <a href="tel:{$store_info.mobile}">{$store_info.mobile}</a>
                    </span>
                </p>
                {/if}
            </div>
        </div>
        <!-- 商品循环 -->
        <!-- 商品循环 -->

        <div class="m-goods">
            {foreach name="order_detail" item="v"}
            <div>

                <div>
                    <div>
                        <p>{$v.name}</p>
                        <p>{$v.spec_detail}</p>
                    </div>
                    <div>
                        <p>
                            <span>￥{$v.price}</span>
                            <span>x{$v.goods_num}</span>
                        </p>
                    </div>
                    <div>
                        <img src="{$v.logo}" alt="">
                    </div>
                </div>
            </div>

            {/foreach}
        </div>

        <!-- 订单金额和优惠券 -->
        <div class="m-money">
            <div>
                <div>
                    <i class="iconfont icon-qianbao1"></i>
                </div>
                <div>
                    <p>
                        <span>运费</span>
                        <span>￥{$order.shipping_price}</span>
                    </p>
                    <p>
                        <span>商品总额</span>
                        <span>￥{$order.final_amount}</span>
                    </p>
                </div>
            </div>
            <div>
                <div>
                    <i class="iconfont icon-wodeyouhuijuan"></i>
                </div>
                <div>
                    <p>
                        <span>优惠券</span>
                        <span>减{$order.coupon_price}</span>
                    </p>
                    <p>
                        <span>代金券</span>
                        <span>减{$order.cash_coupon_price}</span>
                    </p>
                </div>
            </div>
        </div>
        <!-- 选择支付方式 -->
        {if condition="$order.order_status eq 0"}
        <div class="m-pay">
            <div>
                <div>
                    <i class="iconfont icon-tubiaolunkuo-"></i>
                </div>
                <div>
                    <p class="{if condition='$order.pay_type eq 1'} m-pay-zhong {/if}">
                        <span>支付宝支付</span>
                        <span>
                            <img src="__STATIC__/index//img/order/pay.png" alt="">
                        </span>
                    </p>
                    <p class="{if condition='$order.pay_type eq 2'}  m-pay-zhong  {/if}">
                        <span>微信支付</span>
                        <span>
                            <img src="__STATIC__/index//img/order/pay.png" alt="">
                        </span>
                    </p>
                    <p class="{if condition='$order.pay_type eq 3'}  m-pay-zhong  {/if}">
                        <span>余额支付</span>
                        <span>
                            <img src="__STATIC__/index//img/order/pay.png" alt="">
                        </span>
                    </p>
                </div>
            </div>
        </div>
        {/if}
        <!-- 应付总额 -->
        <div class="m-zonge">
            <div>
                <div>
                </div>
                <div>
                    <p>
                        应付总额
                    </p>
                </div>
                <div>
                    ￥{$order.final_amount}
                </div>
            </div>
        </div>
        <!--填写备注 -->
        <div class="m-remark">
            <div>
                <div>
                </div>
                <div>
                    <p>
                        <span>下单时间</span>
                        <span>{$order.addtime|date="Y-m-d H:i",###}</span>
                    </p>
                    <p>
                        <span>订单号</span>
                        <span>{$order.order_sn}</span>
                    </p>
                    <p>
                        <span>备注</span>
                        <span>{if condition="!empty($order.user_note)"}{$order.user_note}{else /}无{/if}</span>
                    </p>
                </div>
            </div>
        </div>
        <!-- 底部浮动框 -->
        <div class="m-foot">
            {if condition="$order.order_status eq 0"}
            <div class="m-goumai">
                <a href="{:url('User/create_repay_order')}?id={$order.id}">付款</a>
                <a href="javascript:;" onclick="cancel_order({$order.id})">取消订单</a>
            </div>
            {/if} {if condition="($order.order_status egt 1) AND ($order.order_status lt 4)"}
            <div class="m-evaluate">
                <a href="javascript:;" onclick="confirm_receive_order({$order.id})">确认收货</a>
            </div>
            {/if} {if condition="$order.order_status eq 4"}
            <div class="m-achieve">
                <a href="">再来一单</a>
                <a href="{:url('User/order_detail')}?id={$order.id}">去评价</a>
            </div>
            {/if} {if condition="$order.order_status eq 8"}
            <div class="m-evaluate">
                <a href="javascript:;">已取消</a>
            </div>
            {/if}
        </div>
    </div>
    <!------------------------ PC ------------------------>

    <div class="PC">
        <!-- 公共头部 -->
        {include file="public/p_header" /}
        <!-- 公共头部结束 -->
        <div class="pc-content">
            {include file="public/p_user" /}

            <div class="PC_right">
                {include file="public/p_user_info" /}
                <div class="pc-tihuan">
                    <div class="pc-zhuangtai">
                        <p>订单状态： {if condition="$order.order_status eq 0"} 待付款 {elseif condition="$order.order_status eq 1" /} {if condition="$order.is_ziqu eq 0"}待发货{else /}待取货{/if} {elseif condition="$order.order_status eq 2" /} 待收货 {elseif condition="$order.order_status eq 4"/} 已完成 {elseif condition="$order.order_status eq 8"}已关闭{/if}
                        </p>
                    </div>
                    <div class="pc-address">
                        {if condition="$order.is_ziqu eq 1"}
                        <p class="pc-name1">
                            <span>自取地址：</span>
                            <span>{$store_info.address}</span>
                        </p>
                        <p class="pc-phone1">
                            <span>联系电话：</span>
                            <span>{$store_info.mobile}</span>
                        </p>
                        {else /}
                        <p class="pc-name" >{$order.consignee}</p>
                            <p class="pc-phone">
                                <span>联系电话：
                                <span>{$order.mobile}</span>
                                </span>
                                <span>送货地址：
                                <span>{$order.address}</span>
                                </span>
                            </p>
                        {/if}
                    </div>
                    <div class="pc-explain">
                        <div>
                            <span>商品
                            </span>
                            <span>
                                <span>单价</span>
                                <span>数量</span>
                                <span>小计</span>
                            </span>
                        </div>
                    </div>
                    <div class="pc-shangpin">
                        <!-- 商品循环开始 -->
                        {foreach name="order_detail" item="vo"}
                        <div>
                            <div>
                                <div>
                                    <img src="{$vo.logo}" alt="">
                                </div>
                                <div>
                                    <p>{$vo.name}</p>
                                    <p>{$vo.spec_detail}</p>
                                </div>
                            </div>
                            <div>
                                <div>
                                    ￥{$vo.price}
                                </div>
                                <div>
                                    x{$vo.goods_num}
                                </div>
                                <div>
                                    ￥{$vo.final_amount}
                                </div>

                            </div>
                        </div>
                        {/foreach}
                        <!-- 商品循环开始 -->
                    </div>
                    {if condition="$order.order_status eq 0"}
                    {if condition="$order.order_status lt 4"}
                    <div class="pc-pay">
                        <label for="zhifubao">
                            <input id="zhifubao" type="radio" value="0" name="pay" {if condition="$order.pay_type eq 1" } checked {/if}>
                            <img src="__STATIC__/index//img/order/zhifubao.png" alt="">
                        </label>
                        <label for="weixin">
                            <input id="weixin" type="radio" value="0" name="pay" {if condition="$order.pay_type eq 2" } checked {/if}>
                            <img src="__STATIC__/index//img/order/weixin.png" alt="">
                        </label>
                        <label for="yue">
                            <input id="yue" type="radio" value="0" name="pay" {if condition="$order.pay_type eq 3" } checked {/if}>
                            <img src="__STATIC__/index//img/order/yue.png" alt="">
                        </label>
                    </div>
                    {/if}
                    {/if}
                    <div class="pc-details">
                        <p class="pc-details-goods">
                            <span>
                                <span>下单时间</span>
                                <span>{$order.addtime|date="Y-m-d H:i",###}</span>
                            </span>
                            <span>
                                <span>商品总额：</span>
                                <span>￥{$order.final_amount}</span>
                            </span>
                        </p>
                        <p class="pc-details-goods">
                            <span>
                                <span>订单号</span>
                                <span>{$order.order_sn}</span>
                            </span>
                            <span>
                                <span>运费：</span>
                                <span>￥{$order.shipping_price}</span>
                            </span>
                        </p>

                        <p class="pc-details-yunfei">
                            <span>
                                <span>优惠券：</span>
                                <span>￥{$order.coupon_price}</span>
                            </span>
                        </p>
                        <p class="pc-details-yunfei">
                            <span>
                                <span>代金券：</span>
                                <span>￥{$order.cash_coupon_price}</span>
                            </span>
                        </p>
                        <p class="pc-details-yunfei">
                            <span>
                                <span>实际付款：</span>
                                <span class="pc-shiji">￥{$order.final_amount}</span>
                            </span>
                        </p>
                        <p class="pc-bottom">
                            {if condition="$order.order_status neq 8"} {if condition="$order.order_status eq 0"}
                            <a href="javascript:;" onclick="cancel_order({$order.id})" class="pc-quxiao">取消订单</a>
                            <a href="{:url('User/create_repay_order')}?id={$order.id}" class="pc-mai">确认购买</a>
                            {elseif condition="$order.order_status eq 1" /}
                            <a href="javascript:;" onclick="confirm_receive_order({$order.id})" class="pc-shouhuo">确认收货</a>
                            {elseif condition="($order.order_status egt 1) AND ($order.order_status lt 4)" /}
                            <a href="javascript:;" onclick="confirm_receive_order({$order.id})" class="pc-shouhuo">确认收货</a>
                            {elseif condition="$order.order_status eq 4" /}
                            <a href="{:url('User/order_pingjia_list')}?id={$order.id}" class="pc-pingjia">去评价</a>
                            {/if} {else /}
                            <a href="javascript:;">交易关闭</a>
                            {/if}

                        </p>
                    </div>
                </div>

            </div>
        </div>
        <!-- 公共脚部  -->
        {include file="public/p_footer" /}
        <!-- 公共脚部 结束 -->

    </div>

</body>

</html>
<script>
    /**
     * 返回上一页
     */
    function go_back() {
        window.location.href = "{:url('User/index')}";
    }

    /**
     * 取消订单
     * @param order_id
     */
    function cancel_order(order_id) {
        $.post("{:url('User/cancel_order')}", {
                id: order_id
            },
            function (data) {
                if (data.code == 1) {
                    layer.msg('取消成功', {
                        icon: 1,
                        time: 1500,
                        shade: 0.1
                    }, function (index) {
                        layer.close(index);
                        location.reload();
                    });
                    return false;
                } else {
                    layer.msg(data.msg, {
                        icon: 2,
                        time: 1500,
                        shade: 0.1
                    }, function (index) {
                        layer.close(index);
                    });
                    return false;
                }
            }
        );
    }
    /**
     * 确认收货
     * @param order_id
     */
    function confirm_receive_order(order_id) {
        $.post("{:url('User/confirm_receive_order')}", {
                id: order_id
            },
            function (data) {
                if (data.code == 1) {
                    layer.msg('操作成功', {
                        icon: 1,
                        time: 1500,
                        shade: 0.1
                    }, function (index) {
                        layer.close(index);
                        location.reload();
                    });
                    return false;
                } else {
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1500,
                        shade: 0.1
                    }, function (index) {
                        layer.close(index);
                        location.reload();
                    });
                    return false;
                }
            }
        )
    }

    /**
     * 完善会员信息
     */
    function edit_member_info() {
        window.location.href = "{:url('User/my_center')}";
    }
</script>